# 课堂练习：
# 猜拳游戏
# 让用户自己出拳  0：石头   1：剪刀     2：布
# 让电脑自己随机出拳，根据双方出拳的结果进行判断，判断游戏的输赢
# 将上述游戏进行改进，游戏可以无限玩
# 课堂思考：是否可以设置游戏次数，到达一次次数后，停止游戏
count=5
import random
while count>0:
    count-=1
    computer = random.randint(0, 2)  # 使用randint方法，随机产生数字，括号内可以指定数字范围
    print(computer)
    user = int(input("请出拳 ：【0：石头   1：剪刀     2：布】"))
    if user == 0 and computer == 1:
        print("真厉害，您赢了！")
    elif user == 0 and computer == 2:
        print("很遗憾，您输了！")
    elif user == 0 and computer == 0:
        print("平局！")
    elif user == 1 and computer == 0:
        print("很遗憾，您输了！")
    elif user == 1 and computer == 2:
        print("真厉害，您赢了！")
    elif user == 1 and computer == 1:
        print("平局！")
    elif user == 2 and computer == 0:
        print("真厉害，您赢了！")
    elif user == 2 and computer == 1:
        print("很遗憾，您输了！")
    elif user == 2 and computer == 2:
        print("平局！")
    else:
        print("您输入有误")
